# 连接数据库
from sqlalchemy.ext.asyncio import AsyncSession
# 数据库表结构
from module_admin.entity.vo.attendance_vo import AttendanceModel
# 数据库操作层
from module_admin.dao.attendance_dao import AttendanceDao
# 下划线形式(snake_case)转小驼峰形式(camelCase)工具方法
from utils.common_util import CamelCaseUtil


class AttendanceService:
    """
    考勤信息模块服务层
    """

    @classmethod
    async def get_attendance_list_services(cls, query_db: AsyncSession, page_object: AttendanceModel, data_scope_sql: str, is_page: bool = False):
        """
        获取考勤列表信息service

        :param query_db: orm对象
        :param page_object: 分页查询参数对象
        :param data_scope_sql: 数据权限对应的查询sql语句
        :param is_page: 是否开启分页
        :return: 考勤列表信息对象
        """
        attendance_list_result = await AttendanceDao.get_attendance_list(query_db, page_object, data_scope_sql, is_page)

        return attendance_list_result
    
    @classmethod
    async def add_attendance_services(cls, query_db: AsyncSession, page_object: AttendanceModel):
        """
        新增考勤信息service
        :param query_db: orm对象
        :param page_object: 新增考勤对象
        :return: 新增结果
        """
        result = await AttendanceDao.add_attendance(query_db, page_object)
        return result 